package com.insta.hibernate.common;

import org.hibernate.Session;

import com.insta.hibernate.DAO.CoursDAO;
import com.insta.hibernate.DAO.EleveDAO;
import com.insta.hibernate.DAO.ProfesseurDAO;
import com.insta.hibernate.model.HibernateUtil;

public class App {

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		Session conn = HibernateUtil.getSession();
		
		EleveDAO.createEleve("Martin", "Kevin", 2011, "student1", conn);
		EleveDAO.createEleve("Elvis", "Paul", 2011, "student2", conn);
		
		EleveDAO.addEmail("student1", "test@test.com", conn);
		EleveDAO.addEmail("student2", "test2@test.com", conn);
		EleveDAO.addEmail("student1", "test3@test.com", conn);
		
		ProfesseurDAO.createProfesseur("prof1", "Dupont", "Alfred", 26, conn);
		ProfesseurDAO.createProfesseur("prof2", "Bertrand", "Yve", 32, conn);
		
		CoursDAO.createCours("Java", "prof1", conn);
		CoursDAO.addEleve("Java", "student1", conn);
		CoursDAO.addEleve("Java", "student2", conn);
		

		CoursDAO.createCours("MYSQL", "prof2", conn);
		CoursDAO.addEleve("MYSQL", "student2", conn);
		
		conn.close();
	}

}
